package com.esri.core.io;

import com.esri.core.internal.io.handler.c;

/* loaded from: classes.dex */
public class ProxySetup {
    public static void setupProxy(String str, int i) {
        setupProxy(str, i, "http");
    }

    public static void setupProxy(String str, int i, String str2) {
        c.a(str, i, str2);
    }

    public static void setupProxy(String str, int i, UserCredentials userCredentials) throws EsriSecurityException {
        setupProxy(str, i, "http", userCredentials);
    }

    public static void setupProxy(String str, int i, String str2, UserCredentials userCredentials) throws EsriSecurityException {
        c.a(str, i, str2);
        c.a(str2 + "://" + str + ":" + i, userCredentials);
    }

    public static void setupProxy(String str, UserCredentials userCredentials) throws EsriSecurityException {
        try {
            int indexOf = str.indexOf("://");
            String substring = str.substring(0, indexOf);
            int i = indexOf + 3;
            int indexOf2 = str.indexOf(58, i);
            c.a(str.substring(i, indexOf2), Integer.parseInt(str.substring(indexOf2 + 1)), substring);
            c.a(str, userCredentials);
        } catch (Exception e) {
            throw new RuntimeException("Please verify the format of the proxy URL. " + e.getLocalizedMessage());
        }
    }
}
